package com.example.rectanimationtest.AnimaUtils;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;

public class MainUpView extends FrameLayout{
	private static final String TAG = "zsr";
	private IAnimationHelper mAnimationHelper;
	private Context mContext;
	private Drawable mRectUpDrawable ;
	private Drawable mRectUpShade;
	private View getFocusView;
	public MainUpView(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}
	public MainUpView(Context context, AttributeSet attrs) {
		super(context, attrs);
		mContext = context;
		setWillNotDraw(false);
	//	onDrawUpRect();
		mAnimationHelper = new IAnimationHelperImp();
		mAnimationHelper.setMainUpView(this);
		//setBackground(getResources().getDrawable(R.drawable.white_light));

	}
	public MainUpView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		
	}
	public void setFocusView(View currentView, View oldView, float scale) {
		getFocusView = currentView;
		mAnimationHelper.setFocusView(currentView, oldView, scale);

	}

	public View getUpView(){
		return this;
	}

	@Override
	protected void onDraw(Canvas canvas) {

		if (mAnimationHelper != null){
			mAnimationHelper.MainUpViewDraw(canvas);
		}
		
	}
	
	public void setUpRectResource(int id) {
		try {
			this.mRectUpDrawable = mContext.getResources().getDrawable(id); // 移动的边框.
			invalidate();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public void setUpRectShadeResource(int id) {
		
		this.mRectUpShade = mContext.getResources().getDrawable(id); // 移动的边框.
		invalidate();
		//setBackground(getResources().getDrawable(id));
	}
	private Rect mShadowPaddingRect = new Rect(0, 0, 0, 0);
	private Rect mUpPaddingRect = new Rect(0, 0, 0, 0);
	
	public Drawable getShadowDrawable() {
		return this.mRectUpShade;
	}
	public Rect getDrawShadowRect() {
		return this.mShadowPaddingRect;
	}
	
	public Drawable getUpRectDrawable() {
		return this.mRectUpDrawable;
	}
	public Rect getDrawUpRect() {
		return this.mUpPaddingRect;
	}




}
